//
//  CapitaFlowTableViewCell.m
//  YiBaoStore
//
//  Created by 吕清毅 on 2018/10/6.
//  Copyright © 2018年 小河. All rights reserved.
//

#import "CapitaFlowTableViewCell.h"

@implementation CapitaFlowTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = TotalWhite;
        [self setMainView];
    }
    return self;
}

- (void)setMainView
{
    if (!self.titleLab) {
        self.titleLab = [UILabel new];
        self.titleLab.textColor = UIColorFromHex(0x020200);
        self.titleLab.font = FontSemiboldSize(14);
        self.titleLab.attributedText = [TTKUtil getAtttributeStringWithLineSpace:0 kern:1.17 and:@"扣除货款"];
        [self addSubview:self.titleLab];
    }
    if (!self.timeLab) {
        self.timeLab = [UILabel new];
        self.timeLab.textColor = UIColorFromHex(0x9F9F9F);
        self.timeLab.font = FontWithSize(12);
        self.timeLab.attributedText = [TTKUtil getAtttributeStringWithLineSpace:0 kern:1 and:@"08-07  21:45"];
        [self addSubview:self.timeLab];
    }
    if (!self.moneyLab) {
        self.moneyLab = [UILabel new];
        self.moneyLab.textColor = UIColorFromHex(0x020200);
        self.moneyLab.font = FontSemiboldSize(14);
        self.moneyLab.attributedText = [TTKUtil getAtttributeStringWithLineSpace:0 kern:1.17 and:@"-200"];
        self.moneyLab.textAlignment = NSTextAlignmentRight;
        [self addSubview:self.moneyLab];
    }
    if (!self.desLab) {
        self.desLab = [UILabel new];
        self.desLab.textColor = UIColorFromHex(0x9F9F9F);
        self.desLab.font = FontWithSize(12);
        self.desLab.attributedText = [TTKUtil getAtttributeStringWithLineSpace:0 kern:1 and:@"可用¥1800"];
        self.desLab.textAlignment = NSTextAlignmentRight;
        [self addSubview:self.desLab];
    }
    if (!self.backView) {
        self.backView = [UIView new];
        self.backView.backgroundColor = UIColorFromHex(0xF9F9F9);
        [self addSubview:self.backView];
    }
    if (!self.orderCodeLab) {
        self.orderCodeLab = [UILabel new];
        self.orderCodeLab.font = FontWithSize(12);
        self.orderCodeLab.attributedText = [TTKUtil getAtttributeStringWithLineSpace:0 kern:1 and:@"订单编号：20421435453463"];
        self.orderCodeLab.textColor = UIColorFromHex(0x9F9F9F);
        [self addSubview:self.orderCodeLab];
    }
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.titleLab.frame = CGRectMake(15, 20, 70, 14);
    self.moneyLab.frame = CGRectMake(SCREENWIDTH-85, 20, 70, 14);
    self.timeLab.frame = CGRectMake(self.titleLab.left, self.titleLab.bottom+5, 120, 12);
    self.desLab.frame = CGRectMake(SCREENWIDTH-115, self.moneyLab.bottom+5, 100, 14);
    self.backView.frame = CGRectMake(15, self.timeLab.bottom+10, SCREENWIDTH-15, 25);
    self.orderCodeLab.frame = CGRectMake(20, self.height-18, SCREENWIDTH-20, 12);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
